
package com.angel.sensors.model.types;

import com.angel.sensors.R;
import com.angel.sensors.model.HardwareSensorMeter;
import com.angel.sensors.model.MeterType;
import com.angel.sensors.model.NumericComponent;
import com.angel.sensors.model.SensorComponent;
import com.angel.sensors.model.SensorStrings;

import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;

public class LightMeter extends HardwareSensorMeter {    
    public LightMeter(Context context) {
        super(context, Sensor.TYPE_LIGHT);
        initComponents(new SensorComponent[]{
            new NumericComponent(SensorStrings.VALUE, "value", 0, 1500, 1, "lux"),
        });
    }

    @Override
    public int getType() {
        return MeterType.LIGHT;
    }
    
    public String getName() {
        return SensorStrings.LIGHT;
    }
    
    public String getText() {
        return context.getResources().getString(R.string.light);
    }
    
    @Override
    public void onSensorChanged(SensorEvent event) {
        updateNumericValue(SensorStrings.VALUE, event.values[0]);
    }
}
